<%@ page language="java" %>

<%@ page import="java.util.*,
                 java.net.*,
                 java.lang.*,
                 com.broadvision.web.util.ViewDynaBean,
		 org.apache.struts.validator.DynaValidatorForm,
                 org.apache.commons.beanutils.PropertyUtils"
%>

<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 

<jsp:useBean id="cmDocTypeView" scope="request" type="com.broadvision.web.util.ViewDynaBean"/> 

<script language="javascript">

function onSubmit(myform) {
  var tmp ;

  tmp = myform.name.value;
  myform.name.value = tmp.stringTrim();
  if (myform.name.value == "") {
    alert("<bean:message bundle='cm.messages' key='cm.content.docType.missingName'/>");
    return false;
  }
  tmp = myform.friendlyName.value;
  myform.friendlyName.value = tmp.stringTrim();
  if (myform.friendlyName.value == "") {
    alert("<bean:message bundle='cm.messages' key='cm.content.docType.missingFriendlyName'/>");
    return false;
  }
  myform.submit();
  return true;
}

function doCancel(theForm) {
  if (theForm != null) {
    theForm.action = '<html:rewrite page="/cm/docTypeSearch.do"/>';
    theForm.submit();
    return true;
  }
  return false;
}

</script>

<html:form action="/cm/docTypeSave">
<html:hidden property="dtAction"/>
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle='cm.messages' key='cm.content.docType.create'/>">
  <tr> 
  <td valign="top" width="100%">
		  
  <div class="pageTitle">
    <logic:equal name="cmDocTypeView" property="action" value="edit">
      <bean:message bundle='cm.messages' key='cm.content.docType.edit'/>
    </logic:equal>
    <logic:notEqual name="cmDocTypeView" property="action" value="edit">
      <bean:message bundle='cm.messages' key='cm.content.docType.create'/>
    </logic:notEqual>
  </div>
  <div class="errorMessage"><html:errors bundle='cm.messages'/></div>
  <div class="pageSubtitle">
    <span class="left"><bean:message bundle='cm.messages' key='cm.content.docType.details'/></span>
    <span class="right">&nbsp;</span>
  </div> 
           
  <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle='cm.messages' key='cm.content.docType.create'/>">
         
    <tr>
      <td valign="top" width="20%" class="label"><bean:message bundle='cm.messages' key='cm.content.docType.name'/>*: </td>
      <td valign="top" class="labelField" width="80%" colspan="2">
        <logic:equal name="cmDocTypeView" property="action" value="edit">
          <html:hidden name="cmDocTypeView" property="name"/>
          <bean:write name="cmDocTypeView" property="name" />
        </logic:equal>
        <logic:notEqual name="cmDocTypeView" property="action" value="edit">
          <html:text name="cmDocTypeView" property="name" maxlength="30" />
        </logic:notEqual>
      </td>
    </tr>
        
    <tr>
      <td valign="top" width="20%" class="label"><bean:message bundle='cm.messages' key='cm.content.docType.fname'/>*: </td>
      <td valign="top" class="labelField" width="80%" colspan="2">
        <html:text name="cmDocTypeView" property="friendlyName" maxlength="80" size="40" />
      </td>
    </tr>
        
  </table>
  <div class="pageButtonWrap" align="right">

    <html:reset styleClass="inputButton" property="resetBtn">
      <bean:message bundle='cm.messages' key="button.reset"/>
    </html:reset>
    &nbsp;&nbsp;
    <html:button styleClass="inputButton" property="cancelBtn" onclick="return doCancel(this.form)">
      <bean:message bundle='cm.messages' key="button.cancel"/>
    </html:button>
    <html:button styleClass="inputButton" property="submitBtn" onclick="return onSubmit(this.form)">
      <bean:message bundle='cm.messages' key="button.save"/>
    </html:button>
  </div>  
      
  <br>

 </td>
 </tr>

</table>
</html:form>
